package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.fabu.XjSpBean;
import com.lwj.liwanjia.impl.DeleteSpView;
import com.lwj.liwanjia.model.DeleteSpModel;

import rx.Subscriber;

/**
 * Created by Administrator on 2018/1/12.
 */

public class DeleteSpPresenter {
    private DeleteSpView deleteSpView;
    private DeleteSpModel deleteSpModel;

    public DeleteSpPresenter(DeleteSpView deleteSpView) {
        this.deleteSpView = deleteSpView;
        this.deleteSpModel = new DeleteSpModel();
    }

    public void deleteSpData(String token, String commodityBatch) {
        deleteSpModel.deleteSpData(token, commodityBatch, new Subscriber<XjSpBean>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {
                deleteSpView.showError((Exception) e);
            }

            @Override
            public void onNext(XjSpBean xjSpBean) {
                deleteSpView.deleteSpData(xjSpBean);
            }
        });
    }
}
